home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 93 / 093.d81 / rel ease source < prev    next >
Text File  |  2022-08-26  |  5KB  |  408 lines

  1.  
  2. open =$ffc0
  3. readst =$ffb7
  4. setlfs =$ffba
  5. setnam =$ffbd
  6. load =$ffd5
  7. getin =$ffe4
  8. clrchn =$ffcc
  9. close =$ffc3   ;a
  10. chrin =$ffcf
  11. chkout =$ffc9  ;x
  12. chkin =$ffc6   ;x
  13. plot =$fff0
  14. chrout =$ffd2
  15. color'pointer =243
  16. screen'line'pointer =209
  17. print'number =$bdcd ;x,a
  18. clear'line =59903
  19.  
  20. .org $c000
  21. .mem
  22. .obj "@0:rel ease c000"
  23. ;dis
  24.  
  25. jmp create'rel
  26. jmp position'at'record
  27. jmp print'to'record
  28. jmp write'to'record
  29. jmp read'record'to'buffer
  30. jmp input'record'to'buffer
  31. jmp search'string
  32. jmp get'error
  33.  
  34. ;sys addr,name$,device,record length,max records
  35.  
  36. create'rel jsr get'name
  37.  
  38. jsr get'number
  39. sty device
  40.  
  41. jsr get'number
  42. sty record'length
  43. jsr get'number
  44. sty record'low
  45. sta record'high
  46. lda #0
  47. sta offset
  48.  
  49. jsr open'error
  50.  
  51. ldy string'length
  52. lda ","
  53. sta buffer,y
  54. iny
  55. lda "l"
  56. sta buffer,y
  57. iny
  58. lda ","
  59. sta buffer,y
  60. iny
  61. lda record'length
  62. sta buffer,y
  63. iny
  64. sty string'length
  65.  
  66. open'file lda #2
  67. jsr close
  68.  
  69. lda #2
  70. ldx device
  71. ldy #2
  72. jsr setlfs
  73. lda string'length
  74. ldy >buffer
  75. ldx <buffer
  76. jsr setnam
  77. jsr open
  78.  
  79. jsr clrchn
  80.  
  81. jsr read'open'error
  82. lda error'string
  83. cmp "0"
  84. beq +
  85. lda #2
  86. jsr close
  87. lda #15
  88. jsr close
  89. jmp clrchn
  90.  
  91. + jsr position
  92. jsr clrchn
  93. ldx #2
  94. jsr chkout
  95. lda #255
  96. jsr chrout
  97. lda #13
  98. jsr chrout
  99. jsr clrchn
  100. jsr position
  101. jsr clrchn
  102. lda #2
  103. jsr close
  104. jsr clrchn
  105. jsr read'open'error
  106. lda #15
  107. jmp close
  108.  
  109. open'error lda #15
  110. jsr close
  111.  
  112. lda #15
  113. ldx device
  114. ldy #15
  115. jsr setlfs
  116. lda #3
  117. ldy >initialize'name
  118. ldx <initialize'name
  119. jsr setnam
  120. jmp open
  121.  
  122. position jsr clrchn
  123. ldx #15
  124. jsr chkout
  125.  
  126. lda "p"
  127. jsr chrout
  128. lda #2
  129. clc
  130. adc #96
  131. jsr chrout
  132. lda record'low
  133. jsr chrout
  134. lda record'high
  135. jsr chrout
  136. lda offset
  137. jsr chrout
  138. lda #13
  139. jmp chrout
  140.  
  141. get'number'store'record jsr get'number
  142. sty record'low
  143. sta record'high
  144. jsr get'number
  145. sty offset
  146. rts
  147.  
  148. write'to'record jsr get'number'store'record
  149. jsr get'string
  150. sta string'length
  151. tax
  152. beq +
  153. jsr position
  154. jsr clrchn
  155. ldx #2
  156. jsr chkout
  157. ldy #0
  158. - lda ($22),y
  159. jsr chrout
  160. iny
  161. cpy string'length
  162. bne -
  163. jsr position
  164. + jmp clrchn
  165.  
  166. print'to'record jsr position'at'record
  167. jsr get'string
  168. sta string'length
  169. tax
  170. beq +
  171. ldx #2
  172. jsr chkout
  173. ldy #0
  174. - lda ($22),y
  175. jsr chrout
  176. iny
  177. cpy string'length
  178. bne -
  179. lda #13
  180. jsr chrout
  181. jsr position
  182. + jmp clrchn
  183.  
  184. position'at'record jsr get'number'store'record
  185. jsr position
  186. jmp clrchn
  187.  
  188. input'record'to'buffer jsr position'at'record
  189.  
  190. ldx #2
  191. jsr chkin
  192. ldy #0
  193. - jsr getin
  194. cmp #13
  195. beq +
  196. sta buffer,y
  197. iny
  198. bne -
  199. + sty wlength
  200. jsr position
  201. jsr clrchn
  202. jsr make'wstring
  203. jmp read'open'error
  204.  
  205. read'record'to'buffer lda #0
  206. sta offset
  207. sta wlength
  208. sta storage
  209. jsr get'number
  210. sty record'low
  211. sta record'high
  212. get'record jsr position
  213. ldx #2
  214. jsr chkin
  215. ldy #0
  216.  
  217. - jsr getin
  218. sta temp
  219. jsr readst
  220. and #64
  221. beq +
  222. dec storage
  223. + lda temp
  224. sta buffer,y
  225. iny
  226. bit storage
  227. bpl -
  228. sty wlength
  229. jsr position
  230. jsr clrchn
  231. jsr make'wstring
  232. jmp read'open'error
  233.  
  234. ;search,string,begin,offset
  235. search'string jsr get'string
  236. sta string'length
  237. tax
  238. bne +
  239. rts
  240. + ldy #0
  241. - lda ($22),y
  242. ora #128
  243. sta buffer,y
  244. iny
  245. cpy string'length
  246. bne -
  247.  
  248. ldy #0
  249. sty 251
  250. sty 252
  251.  
  252. jsr get'number'store'record
  253.  
  254. start'search jsr position
  255. ldx #15
  256. jsr chkin
  257. jsr getin
  258. cmp "0"
  259. bne search'out
  260. jsr clrchn
  261. ldx #2
  262. jsr chkin
  263.  
  264. ldy #0
  265.  
  266. - jsr getin
  267. ora #128
  268. cmp buffer,y
  269. bne darnit
  270. iny
  271. cpy string'length
  272. bne -
  273. lda "1"
  274. sta 631
  275. lda #1
  276. sta 198
  277.  
  278. lda record'low
  279. sta 251
  280. lda record'high
  281. sta 252
  282.  
  283. search'out jsr position
  284. lda #0
  285. sta offset
  286. jmp read'open'error
  287.  
  288. darnit inc record'low
  289. bne +
  290. inc record'high
  291. beq search'out
  292. + jmp start'search
  293.  
  294.  
  295. get'name jsr get'string
  296. sta string'length
  297. tay
  298. dey
  299. - lda ($22),y
  300. sta buffer,y
  301. dey
  302. bpl -
  303.  
  304. rts
  305.  
  306. get'error lda #15
  307. jsr close
  308. jsr get'number
  309. sty device
  310. jsr clrchn
  311. lda #15
  312. ldx device
  313. ldy #15
  314. jsr setlfs
  315. lda #0
  316. jsr get'string
  317. jsr setnam
  318. jsr open
  319. jsr read'open'error
  320. lda #15
  321. jmp close
  322.  
  323. ;***** get string from BASIC ****
  324.  
  325. get'string jsr $aefd
  326. jsr $ad9e
  327. jsr $b6a3
  328. ldx $22
  329. ldy $23
  330. rts
  331.  
  332. get'number jsr $aefd
  333. jsr $ad8a
  334. jmp $b7f7
  335.  
  336. read'error jsr open'error
  337. read'open'error ldx #15
  338. jsr chkin
  339. ldy #0
  340.  
  341. - jsr getin
  342. sta error'string,y
  343. iny
  344. cmp #13
  345. bne -
  346. iny
  347. sty elength
  348. jsr clrchn
  349.  
  350. ldx <error'name
  351. ldy >error'name
  352. jsr locvar
  353. lda <elength
  354. ldy >elength
  355. jmp set'string
  356.  
  357. locvar lda $7a
  358. pha
  359. lda $7b
  360. pha
  361. stx $7a
  362. sty $7b
  363. jsr $b08b
  364. sta $49
  365. sty $4a
  366. pla
  367. sta $7b
  368. pla
  369. sta $7a
  370. rts
  371.  
  372. set'string sta $64
  373. sty $65
  374. jmp $aa52
  375.  
  376. make'wstring ldx <string'name
  377. ldy >string'name
  378. jsr locvar
  379. lda <wlength
  380. ldy >wlength
  381. jmp set'string
  382.  
  383.  
  384. string'name .asc "w$":.byt 0
  385. wlength .byt 0
  386. .word buffer
  387.  
  388. error'name .asc "e$":.byt 0
  389. elength .byt 0
  390. .word error'string
  391. error'string .buf 50
  392. buffer .buf 256
  393. string'length .byt 0
  394. number .buf 5
  395. initialize'name .asc "i0:"
  396. device .byt 8
  397. error'flag .byt 0
  398. temp .byt 0
  399. record'low .byt 0
  400. record'high .byt 0
  401. offset .byt 0
  402. record'length .byt 0
  403. reverse .byt 0
  404. storage .byt 0
  405.  
  406.  
  407.  
  408.